# -*- coding: utf-8 -*-
# author: AZJ
# date: 2024/11/7
# 假如命运扼住了你的咽喉，你就去挠她的咯吱窝

# 定义了一个学生类：属性:学号，姓名，年龄，性别，身高，体重，成绩，家庭地址，电话号码。
# 行为：学习（要求参数传入学习的时间），玩游戏（要求参数传入游戏名），编程（要求参数传入写代码的行数），
# 数的求和（要求参数用变长参数来做，返回求和结果
class Student:
    def __init__(self, student_id, name, age, gender, height, weight, score, home_address, phone_number):
        self.student_id = student_id
        self.name = name
        self.age = age
        self.gender = gender
        self.height = height
        self.weight = weight
        self.score = score
        self.home_address = home_address
        self.phone_number = phone_number
    def study(self, study_time):
        print(f"{self.name}的学习时长为: {study_time}")
        return
    def play(self, game_name):
        print(f"{self.name}正在玩: {game_name}")
    def programming(self, programming_rows):
        print(f"{self.name}的编程行数为: {programming_rows}")
    def sum_number(self, *n):
        num = 0
        for i in range(0, len(n)):
            num += n[i]
        print(f"{self.name}正在做累加, 计算结果为: {num}")
        return num

# ii.车类：属性：车型号，车轮数，车身颜色，车重量，油箱存储大小 。
# 功能：跑（要求参数传入车的具体功能，比如越野，赛车）
# 创建：法拉利，宝马，铃木，五菱，拖拉机对象
class Car:
    def __init__(self, car_model, car_wheel_num, car_color, car_wight, fuel):
        self.car_model = car_model
        self.car_wheel_num = car_wheel_num
        self.car_color = car_color
        self.car_wight = car_wight
        self.fuel = fuel
    def run(self, func):
        print(f"{self.car_model}能够{func}")

# 笔记本：属性：型号，待机时间，颜色，重量，cpu型号，内存大小，硬盘大小。  行为：打游戏（传入游戏的名称）,办公。
class Laptop:
    def __init__(self, model, sleep_time, color, weight, cpu_model, memory, disk):
        self.model = model
        self.sleep_time = sleep_time
        self.color = color
        self.weight = weight
        self.cpu_model = cpu_model
        self.memory = memory
        self.disk = disk
    def play(self, game_name):
        print(f"正在使用{self.model}玩{game_name}")
    def work(self):
        print(f"正在使用{self.model}办公")

# 猴子类：属性：类别，性别，身体颜色，体重。
# 行为：造火（要求传入造火的材料：比如木棍还是石头），学习事物（要求参数传入学习的具体事物，可以不止学习一种事物）
class Monkey:
    def __init__(self, category, gender, body_color, wight):
        self.category = category
        self.gender = gender
        self.body_color = body_color
        self.wight = wight
    def fire(self, material):
        print(f"{self.category}使用{material}造火")
    def study(self, *study_thing):
        for i in study_thing:
            print(f"{self.category}在学习: {i}")

# 人类：
# 属性:
# 姓名，性别，年龄，所拥有的手机剩余话费，手机品牌，手机电池容量，手机屏幕大小，手机最大待机时长，所拥有的积分。
class Human:
    def __init__(self, gender, age, phone_charge, phone_brand, battery_capacity, screen_size, sleeping_time, points):
        self.gender = gender
        self.age = age
        self.phone_charge = phone_charge
        self.phone_brand = phone_brand
        self.battery_capacity = battery_capacity
        self.screen_size = screen_size
        self.sleeping_time = sleeping_time
        self.points = points
    def text(self, content):
        print(content,f"——由{self.phone_brand}发送")
    # 打电话（要求传入要打的电话号码和要打的时间长度。程序里判断号码是否为空或者本人的话费是否小于1元，
    def phone(self, phone_number: str, phone_time):
        # 若为空或者小于1元则报相对应的错误信息，否则的话拨通。结束后，按照时间长度扣费并返回扣费并且按照分钟给手机卡累加积分（
        # 0~10分钟：1元/钟、15个积分/钟，10~20分钟：0.8元/钟、39个积分/钟，其他：0.65元/钟、48个积分/钟））
        if self.phone_charge < 1 or phone_number == "":
            print("存在错误! ")
            return -1
        if 0 < phone_time <= 10:
            charge_paste = phone_time
            point_get = 15 * phone_time
            self.phone_charge -= charge_paste
            self.points += point_get
        elif 10 < phone_time <= 20:
            charge_paste = 0.8 * phone_time
            point_get = 39 * phone_time
            self.phone_charge -= charge_paste
            self.points += point_get
        else:
            charge_paste = 0.65 * phone_time
            point_get = 48 * phone_time
            self.phone_charge -= charge_paste
            self.points += point_get
        print(f"剩余话费:{self.phone_charge}, 剩余积分:{self.points}")

if __name__ == '__main__':
    print("----------------\t学生类\t----------------")
    student = Student(1, "萧炎", 18, "男", 180, 75, 100, "斗气大陆", "12345")
    student.study("三年")
    student.play("黑神话: 悟空")
    student.programming(100)
    student.sum_number(1, 2, 3, 4)

    print("----------------\t汽车类\t----------------")
    ferrari = Car("法拉利296", 4, "red", 1540, 65)
    bmw = Car("宝马Z4", 4, "black", 1540, 52)
    suzuki = Car("维特拉", 4, "brown", 1170, 47)
    wuling = Car("五菱佳辰", 4, "black", 1670, 52)
    tractor = Car("C1302履带式拖拉机", 12, "red", 7300,260)
    ferrari.run("作为跑车赛车")
    bmw.run("作为跑车赛车")
    suzuki.run("越野")
    wuling.run("载人旅行")
    tractor.run("播撒肥料")

    print("----------------\t笔记本类\t----------------")
    laptop = Laptop("微星绝影14 AI Studio", 8, "black", 1.64, "英特尔 酷睿Ultra 7 155H", 64, 1024)
    laptop.work()
    laptop.play("刺客信条")

    print("----------------\t猴子类\t----------------")
    monkey = Monkey("金丝猴", "雄性", "yellow", 10)
    monkey.fire("干燥树枝")
    monkey.study("游泳", "攀爬")

    print("----------------\t打电话业务逻辑\t----------------")
    human = Human("男", 18, 10, "华为Mate70", 5500,6.69, 96, 60)
    human.text("我爱你")
    human.phone("10086", 10)